package asteroids.model.programs.parsing;

import java.util.List;

import asteroids.expressions.*;
import asteroids.statements.*;
import asteroids.types.*;

public class FactoryImplementation<E, S ,T> implements ProgramFactory<Expression, Statement, Type> {

	@Override
	public Expression createDoubleLiteral(int line, int column, double d) {
		return new DoubleLiteral(line, column, d);
	}

	@Override
	public Expression createBooleanLiteral(int line, int column, boolean b) {
		return new BooleanLiteral(line, column, b);
	}

	@Override
	public Expression createAnd(int line, int column, Expression e1,
			Expression e2) {
		return new AndExpression(line, column, e1, e2);
	}

	@Override
	public Expression createOr(int line, int column, Expression e1,
			Expression e2) {
		return new OrExpression(line, column, e1, e2);
	}

	@Override
	public Expression createNot(int line, int column, Expression e) {
		return new NotExpression(line, column, e);
	}

	@Override
	public Expression createNull(int line, int column) {
		return new NullExpression(line, column);
	}

	@Override
	public Expression createSelf(int line, int column) {
		return new SelfExpression(line, column);
	}

	@Override
	public Expression createGetX(int line, int column, Expression e) {
		return new GetXPositionExpression(line, column, e);
	}

	@Override
	public Expression createGetY(int line, int column, Expression e) {
		return new GetYPositionExpression(line, column, e);
	}

	@Override
	public Expression createGetVX(int line, int column, Expression e) {
		return new GetXVelocityExpression(line, column, e);
	}

	@Override
	public Expression createGetVY(int line, int column, Expression e) {
		return new GetYVelocityExpression(line, column, e);
	}

	@Override
	public Expression createGetRadius(int line, int column, Expression e) {
		return new GetRadiusExpression(line, column, e);
	}

	@Override
	public Expression createVariable(int line, int column, String name) {
		return new VariableExpression(line, column, name);
	}

	@Override
	public Expression createLessThan(int line, int column, Expression e1,
			Expression e2) {
		return new LessThanExpression(line, column, e1, e2);
	}

	@Override
	public Expression createGreaterThan(int line, int column, Expression e1,
			Expression e2) {
		return new GreaterThanExpression(line, column, e1, e2);
	}

	@Override
	public Expression createLessThanOrEqualTo(int line, int column,
			Expression e1, Expression e2) {
		return new LessThanOrEqualExpression(line, column, e1, e2);
	}

	@Override
	public Expression createGreaterThanOrEqualTo(int line, int column,
			Expression e1, Expression e2) {
		return new GreaterThanOrEqualExpression(line, column, e1, e2);
	}

	@Override
	public Expression createEquality(int line, int column, Expression e1,
			Expression e2) {
		return new EqualExpression(line, column, e1, e2);
	}

	@Override
	public Expression createInequality(int line, int column, Expression e1,
			Expression e2) {
		return new NotEqualExpression(line, column, e1, e2);
	}

	@Override
	public Expression createAdd(int line, int column, Expression e1,
			Expression e2) {
		return new AdditionExpression(line, column, e1, e2);
	}

	@Override
	public Expression createSubtraction(int line, int column, Expression e1,
			Expression e2) {
		return new SubstractionExpression(line, column, e1, e2);
	}

	@Override
	public Expression createMul(int line, int column, Expression e1,
			Expression e2) {
		return new MultiplicationExpression(line, column, e1, e2);
	}

	@Override
	public Expression createDivision(int line, int column, Expression e1,
			Expression e2) {
		return new DivisionExpression(line, column, e1, e2);
	}

	@Override
	public Expression createSqrt(int line, int column, Expression e) {
		return new SquareRootExpression(line, column, e);
	}

	@Override
	public Expression createGetDirection(int line, int column) {
		return new GetDirectionExpression(line, column, null);
	}

	@Override
	public Expression createSin(int line, int column, Expression e) {
		return new SinExpression(line, column, e);
	}

	@Override
	public Expression createCos(int line, int column, Expression e) {
		return new CosExpression(line, column, e);
	}

	@Override
	public Statement createEnableThruster(int line, int column) {
		return new EnableThrusterStatement(line, column);
	}

	@Override
	public Statement createDisableThruster(int line, int column) {
		return new DisableThrusterStatement(line, column);
	}

	@Override
	public Statement createFire(int line, int column) {
		return new FireStatement(line, column);
	}

	@Override
	public Statement createTurn(int line, int column, Expression angle) {
		return new TurnStatement(line, column, angle);	
	}

	@Override
	public Statement createAssignment(int line, int column, String variable,
			Expression rhs) {
		return new AssignmentStatement(line, column, variable, rhs);
	}

	@Override
	public Statement createIf(int line, int column, Expression condition,
			Statement then, Statement otherwise) {
		return new IfThenElseStatement(line, column, condition, then, otherwise);
	}

	@Override
	public Statement createWhile(int line, int column, Expression condition,
			Statement body) {
		return new WhileLoopStatement(line, column, condition, body);
	}

	@Override
	public Statement createForeach(int line, int column, ForeachType type,
			String variableName, Statement body) {
		return new ForEachLoopStatement(line, column, type, variableName, body);
	}

	@Override
	public Statement createSkip(int line, int column) {
		return new SkipStatement(line, column);
	}

	@Override
	public Statement createSequence(int line, int column,
			List<Statement> statements) {
		return new SequenceStatement(line, column, statements);
	}

	@Override
	public Statement createPrint(int line, int column, Expression e) {
		return new PrintStatement(line, column, e);
	}

	@Override
	public Type createDoubleType() {
		return new DoubleType();
	}

	@Override
	public Type createBooleanType() {
		return new BooleanType();
	}

	@Override
	public Type createEntityType() {
		return new EntityType();
	}

}
